cmake_minimum_required(VERSION 2.6)
project(libevent)

if (MSVC)
    file(GLOB_RECURSE libevent_HEADER *.h)
    set(libevent_SRC
        event.c
        buffer.c 
        bufferevent.c 
        bufferevent_sock.c
        bufferevent_pair.c
        listener.c
        evmap.c
        log.c
        evutil.c
        strlcpy.c 
        signal.c 
        bufferevent_filter.c 
        evthread.c
        bufferevent_ratelim.c 
        evutil_rand.c
        
        win32select.c 
        evthread_win32.c 
        buffer_iocp.c
        event_iocp.c 
        bufferevent_async.c
        
        event_tagging.c
        http.c
        evdns.c
        evrpc.c
    )
    
    set(__INCLUDE 
        ${CMAKE_CURRENT_SOURCE_DIR}/include
        ${CMAKE_CURRENT_SOURCE_DIR}/compat
        ${CMAKE_CURRENT_SOURCE_DIR}/WIN32-Code
    )
    set(libevent_INCLUDE ${__INCLUDE} PARENT_SCOPE)
    

    include_directories(
        ${__INCLUDE}
    )
    
    add_library(libevent ${libevent_HEADER} ${libevent_SRC})
endif()